package com.linkhouse.common;

import java.io.Serializable;

public class Result<T> implements Serializable{
    private Integer code;
    private String  message;
    private T  data;

    public static com.linkhouse.common.Result OK(){
        com.linkhouse.common.Result result = new com.linkhouse.common.Result();
        result.setCode(com.linkhouse.common.ResultEnum.SUCCESS.getStatus()); //自定义成功返回码
        result.setMessage(com.linkhouse.common.ResultEnum.SUCCESS.getStatusInfo());
        return result;
    }

    public static com.linkhouse.common.Result R(com.linkhouse.common.ResultEnum resultEnum){
        com.linkhouse.common.Result Result = new com.linkhouse.common.Result();
        Result.setCode(resultEnum.getStatus());
        Result.setMessage(resultEnum.getStatusInfo());
        return Result;
    }


    public Result() {
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public com.linkhouse.common.Result<T> setData(T data) {
        this.data = data;
        return this;
    }
}
